﻿<!DOCTYPE HTML>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/head :: commonHead('订单列表')">
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 订单管理 <span class="c-gray en">&gt;</span> 订单列表
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i id="shuaxin" class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
	<form action="/admin/findOrderByKey">
		<input type="text" th:value="${keyTmp}" class="input-text" style="width:250px" placeholder="输入关键词,如姓名、车牌等" name="keyTmp" />
		<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜订单</button>
	</form>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
	<span class="r">共有数据：<strong th:text="${orderNum}"></strong> 条</span> </div>
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="10">订单列表</th>
			</tr>
			<tr class="text-c">
				<th width="45">序号</th>
				<th width="100">订单编号</th>
				<th width="100">姓名</th>
				<th width="100">电话</th>
				<th width="150">创建时间</th>
				<th width="100">车牌号</th>
				<th width="100">车位编号</th>
				<th width="100">支付金额</th>
				<th width="100">状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			<tr class="text-c" th:each="order,orderStat : ${orderList}">
				<td>
				<span th:text="${orderStat.index+1}"></span>
				<input type="hidden" th:value="${order.id}" class="inp"/>
				</td>
				<td th:text="${order.code}"></td>
				<td th:text="${order.user_name}"></td>
				<td th:text="${order.phone}"></td>
				<td th:text="${#calendars.format(order.createDate,'yyyy-MM-dd')}"></td>
				<td th:text="${order.plate_num}"></td>
				<td th:text="${order.park_name}"></td>
				<td th:text="${order.total}"></td>
				<td class="td-status">
				<span class="label radius"  th:if="${order.status}==0">待付款</span>
				<span class="label radius label-success"  th:if="${order.status}!=0">订单完成</span></td>
				<td class="td-manage">
				<a title="删除" href="javascript:;" onclick="order_del(this)"
				class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
				</td>
			</tr>
		</tbody>
	</table>
</div>

<!-- 引入公共js -->
<span th:include="/common/on-load-js :: commonOnLoadJs"></span>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

function order_del(obj){
	layer.confirm('确认要删除吗？',function(index){
		var orderId = $(obj).parents("tr").find(".inp").val();
		$.ajax({
			type: 'POST',
			url: '/admin/delOrder',
			data:{"orderId":orderId},
			dataType: 'json',
			success: function(data){
				if(data.res==0){
					$(obj).parents("tr").remove();
					layer.msg('已删除!',{icon:1,time:1000});
				}else{
					layer.msg('操作失败!',{icon: 2,time:1000});
				}
			}
		});		
	});
}
</script>
</body>
</html>